﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta name="viewport" content="width=device-width"/>
<meta name="description" content="筑学堂网校" />
<meta name="keywords" content="筑学堂网校、建筑、考试"/>
<link href="http://www.zhuclass.com/img/icon.ico" type="image/x-icon" rel="icon"  />
<link href="http://www.zhuclass.com/img/icon.ico" type="image/x-icon" rel="shortcut icon"  />
<link rel="stylesheet" type="text/css" href="../../style/share/style.css">
<link rel="stylesheet" type="text/css" href="../../style/share/kczx.css">
<link rel="stylesheet" type="text/css" href="../../style/share/home_style.css">
<link rel="stylesheet" type="text/css" href="../../style/user.css">
<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->
<script type="text/javascript" src="../../js/home.js"></script>
<script type="text/javascript" src="../../js/ajaxfileupload.js"></script>
        <script type="text/javascript">
    function ajaxFileUpload()
    {
        
        $("#loading")
        .ajaxStart(function(){
            $(this).show();
        })//开始上传文件时显示一个图片
        .ajaxComplete(function(){
            $(this).hide();
        });//文件上传完成将图片隐藏起来
        
        $.ajaxFileUpload
        (
            {
                url:'${uploadURL}',//用于文件上传的服务器端请求地址
                secureuri:false,//一般设置为false
                fileElementId:'fileInput',//文件上传空间的id属性  <input type="file" id="file" name="file" />
                dataType: 'json',//返回值类型 一般设置为json
                success: function (data, status)  //服务器成功响应处理函数
                {
                	if(data.code != 1)
                    {
                	alert(status);
                	 $.ajax({ url: "../add_group_share/${group_id}/"+data.id+"/"+data.oid+"/"+data.flength+"/"+data.filename+"/"+data.code, 
          		       success: function(result){
          	           	alert(result);
	          	        }
	          	       });
                    }else{
                    	alert(data.msg)
                    }
                },
                error: function (data, status, e)//服务器响应失败处理函数
                {
                    alert(e);
                }
            }
        )
        
        return false;

    }
    
    function downfile(file_id,name,share_id){
    	var url = "${downloadURL}"+file_id+"?fnm="+name;
    	window.location.href=url; 
    	$.ajax({ url: "../down_group_share/"+share_id, 
		       success: function(result){
	           }
	    });
    }
    
    function deleteShare(share_id){
    	$.ajax({ url: "../delete_group_share/"+share_id, 
		       success: function(result){
		    	   alert(result);
		    	   $.ajax({ url: "../query_group_share/${group_id}/1/null", 
		    	       success: function(result){
		                  $("#mainPageDiv").html(result);
		               }
		           });
	           }
	    });
    }
    
    
    //首页
	   function firstPage(){
		  $.ajax({ url: "../query_group_share/${group_id}/1/${pageSize}", 
			       success: function(result){
		              $("#mainPageDiv").html(result);
		           }
		  });
		}
	 //上一页
	   function upPage(){
		      var pageNo = '${pageNo}';
		      var upNo = Number(pageNo) - 1 ;
		      if(Number(pageNo)>1){
		    	  $.ajax({ url: "../query_group_share/${group_id}/"+upNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			     });
		      }
			  
		}
	   //下一页
	   function nextPage(){
		      var pageNo = '${pageNo}';
		      var sumPageNum = '${sumPageNum}';
		      var nextNo = Number(pageNo) + 1 ;
		      if(Number(pageNo)<Number(sumPageNum)){
		    	  $.ajax({ url: "../query_group_share/${group_id}/"+nextNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			     });
		      }
		}
	   //跳转页
	   function gotoPage(obj){
		      var pageNo = $(obj).val();
			  $.ajax({ url: "../query_group_share/${group_id}/"+pageNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			  });
		}
	   
    
    
    </script>
<title>筑学堂家园个人空间</title>
<style type="text/css">
a {
	color:#222;
}
a:hover {
	color:#888;
}

li {
	list-style-type:none;
}
</style>
</head>
<body style="align:center; padding:0;margin:0;clear:both; background-color:FFF;">
  <div class="home_group">
		
		<div class="home_groupnotice" style="min-height:30px;">
			<c:if test="${isMember==0}">
			<div class="pic_top02" style="position:relative;left:0px;top:10px;float:right;background-color:#209E85;color:#EEE">
			
			<div class="opac" style="width:90px;overflow:hidden;">
											<form>
												<input type="file"  id="fileInput"  name="upload" accept="file" onchange="ajaxFileUpload();">
											</form>
										</div>
			 <img src="../../images/add.png">上传共享</div>
			 </c:if>
		</div>
			<div class="home_groupnotice">
				<div class="home_grnottit"> 群共享 </div>
				<div class="home_groupnot">
				
				<c:forEach items="${data.data}" var="li">
					<div class="zyzx_more_zt01">
						<table class="zyzx_more_tab01">
							<tbody>
								<tr>
									<td height="15px" width="600px"> </td>
								</tr>
								<tr>
									<td height="25px" style="font-size:14px;font-weight:bold;"> <a href="#"> <img src="../../images/zyzx_images/word.png"> ${li.topic} </a> </td>
									<td rowspan="3">
									 <a href="#" onclick="downfile('${li.file_id}','${li.name}',${li.share_id})">
										<div class="share_xz01" style="background-color:#F39C4F;">
											<div class="share_xz02"> ${li.down_cnt} </div>
											下&nbsp;载
										 </div>
										</a>
									 </td>
								</tr>
								<tr>
									<td height="25px" style="color:#888;"> 大小：${li.file_size}  
										&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#333;"> 标签：</span>${li.tag_id} </td>
								</tr>
								<tr>
									<td height="25px"> <a href="#"> ${li.author_id}</a> 上传于${li.create_dt}&nbsp;&nbsp;
										&nbsp;&nbsp;&nbsp;&nbsp; <a href="#"> <img src="../../images/zyzx_images/ping.png"> 评论${li.comment_cnt} </a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="#"> <img src="../../images/zyzx_images/liu.png"> 点击${li.view_cnt} </a> &nbsp;&nbsp;&nbsp;&nbsp;<!-- <a href="#"> 编辑 </a>&nbsp; -->  
										<c:if test="${li.author_id}==${userId}">
											<a href="#" onclick="deleteShare(${li.share_id})"> 删除 </a> 
										</c:if>
										</td>
								</tr>
							</tbody>
						</table>
					</div>
				</c:forEach>
				</div>
				
				<!--页面切换-->
				<div class="page_div">
					<div class="page_body">
					    <a href="#"> 
					      <div class="kczx_divlb01" onclick="firstPage()" >首&nbsp;页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						
						<a href="#">
						  <div class="kczx_divlb01" onclick="upPage()" >上一页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						
						<a href="#">
						 <div class="kczx_divlb01" onclick="nextPage()" >下一页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						<select class="kczx_divlb01 page_select" onchange="gotoPage(this)" id="hostSelect">
						    <c:forEach begin="1" end="${sumPageNum}" var="i">  
							     <option value="${i}" <c:if test="${pageNo == i}"> selected="selected" </c:if>  >
							        第${i}页
							     </option>
						     </c:forEach> 
						</select>
					</div>
				</div>
				<!--end页面切换--> 
			</div>
		</div>


</body>
</html>